package com.juice.actuator;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @desc:
 * @author: panxiyi
 * @date: 2023/5/14 3:09 下午
 */

@Component
public class InfoConfig implements InfoContributor {

    @Value("${info.appName}")
    private String appName;

    @Value("${info.version}")
    private String version;

    @Value("${info.author}")
    private String author;

    @Override
    public void contribute(Info.Builder builder) {
        builder.withDetail("runTime", System.currentTimeMillis());
        Map infoMap =  new HashMap<>();
        infoMap.put("buildTime", 2006);
        infoMap.put("Tel", 17850396689L);
        infoMap.put("appName", appName);
        infoMap.put("version", version);
        infoMap.put("author", author);
        builder.withDetails(infoMap);


    }
}
